package cn.dkdoo.utils.config.exception;

import org.slf4j.helpers.FormattingTuple;
import org.slf4j.helpers.MessageFormatter;

/**
 * @author nicky
 * @date 2021/5/10 下午3:38
 */
public class DkdTransactionException extends RuntimeException {
    private String message;

    public DkdTransactionException() {
    }

    public DkdTransactionException(String message, String... params) {
        super(message);
        if (params != null && params.length > 0) {
//            message = MessageFormat.format(message, params);
            FormattingTuple ft = MessageFormatter.arrayFormat(message,  params);
            message = ft.getMessage();
        }
        this.message = message;
    }

    @Override
    public String getMessage() {
        return message;
    }

}
